{% set pypi_name = 'python-mistralclient' %}
{% set upstream_version = upstream_version('4.1.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

%global oldpython python
Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Epoch:          {{ epoch('python-mistralclient') }}
Summary:        Python API and CLI for OpenStack Mistral
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('python-openstackclient') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('osprofiler') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildArch:      noarch

%description
Client library for Mistral built on the Mistral API. It provides a Python API
(the mistralclient module) and a command-line tool (mistral).

%package -n python3-mistralclient
Summary:        Python API and CLI for OpenStack Mistral
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('os-client-config') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('osprofiler') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Conflicts:      %{oldpython}-mistralclient < %version

%description -n python3-mistralclient
Client library for Mistral built on the Mistral API. It provides a Python API
(the mistralclient module) and a command-line tool (mistral).

This package contains the Python 3.x module.

%package -n python-mistralclient-doc
Summary:        Documentation for OpenStack Mistral API client libary
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n python-mistralclient-doc
Client library for Mistral built on the Mistral API. It provides a Python API
(the mistralclient module) and a command-line tool (mistral).
This package contains the documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

# Build HTML docs
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
rm -r doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n python3-mistralclient
%license LICENSE
%{python3_sitelib}/mistralclient
%{python3_sitelib}/*.egg-info
%{_bindir}/mistral

%files -n python-mistralclient-doc
%license LICENSE
%doc README.rst doc/build/html

%changelog
